package platform.cmdexecutor;

import java.io.IOException;
import java.util.List;
import java.util.logging.Level;

import platform.ProcessOutputFetcher;
import util.LoggingUtils;

public class WindowsPlatformCommandExecutor extends PlatformCommandExecutor {
	private static WindowsPlatformCommandExecutor _instance;

	public static WindowsPlatformCommandExecutor getInstance() {
		if (_instance == null) {
			_instance = new WindowsPlatformCommandExecutor();
		}
		return _instance;
	}

	private WindowsPlatformCommandExecutor() {
	}

	@Override
	protected List<String> getCommandList() {
		List<String> cmd = super.getCommandList();
		// cmd.add(2, "-Djna.library.path=\"C:\\Program Files\\VideoLAN\\VLC\"");
		return cmd;
	}
	@Override
	public void restartComputer() {
		ProcessBuilder pb = new ProcessBuilder("shutdown", "/r");
		try {
			Process p = pb.start();
			ProcessOutputFetcher fetcher = new ProcessOutputFetcher();
			System.out.println(fetcher.getProcessOutput(p));
		} catch (IOException e) {
			LoggingUtils.log(Level.SEVERE, "WindowsPlatformCommandExecutor.java ()",e);
		}
		catch(Exception ex)
		{
			LoggingUtils.log(Level.SEVERE, "WindowsPlatformCommandExecutor.java ()",ex);
		}
	}

}
